package com.java.tutorials.jdk7.fileoperation;
import com.java.tutorials.Constants;

import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
/**
 * Created by xuzhike on 2016/1/25.
 * http://www.java2s.com/Code/Java/JDK-7/Readallfilecontenttoabytearray.htm
 *
 Read all file content to a byte array
 */
public class Readallfilecontenttoabytearray {
    public static void main(String[] args) throws IOException {
        Path path = Paths.get(Constants.TEST_FILE_WITH_PATH);
        byte[] contents = Files.readAllBytes(path);

        for (byte b : contents) {
            System.out.print((char) b);
        }

    }
}
